<?php

namespace app\common\model\xilujob;

use think\Cache;
use think\Model;


class NewsCategory extends Model
{

    

    

    // 表名
    protected $name = 'xilujob_news_category';
    const CACHE_KEY = 'news_category';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];




    public static function getAll() {
        $cacheKey = self::CACHE_KEY;
        $all = Cache::get($cacheKey);
        if(!$all) {
            $all = static::order('weigh')->select();
            Cache::set($cacheKey, $all, 3600);
        }
        return $all;
    }





}
